﻿using System;

namespace UlsLogViewer.Entities
{
    public enum FilterCategory
    {
        Process,
        Thread,
        Product,
        Category,
        EventID,
        Level,
        Message,
        Correlation
    }

    public enum FilterType
    {
        Contains,
        StartsWith,
        EndsWith,
        Equals
    }

    public class Filter
    {
        public bool FilterEnabled { get; set; }

        public string FilterCategory { get; set; }

        public FilterCategory? Category
        {
            get 
            {
                FilterCategory? value = null;
                if(!string.IsNullOrEmpty(FilterCategory))
                {
                    value = (FilterCategory)Enum.Parse(typeof (FilterCategory), FilterCategory);
                }
                return value;
            }
        }

        public string FilterType { get; set; }

        public FilterType? Type
        {
            get
            {
                FilterType? value = null;
                if (!string.IsNullOrEmpty(FilterType))
                {
                    value = (FilterType)Enum.Parse(typeof(FilterType), FilterType);
                }
                return value;
            }
        }

        public string FilterValue { get; set; }

        public string Join { get; set; }
    }
}
